<?php
	//views/home/contactus.ctp
?>
<div class="title_img_center span-4 last margintop-17">
	<span>
	Liên hệ
	</span>
</div>
<?php echo $html->css('contact');?>
<script type="text/javascript">
	function validateForm( ) {
		txtname = document.getElementById('HomeFullname').value;
		txtemail = document.getElementById('HomeEmail').value;
		txtcontent = document.getElementById('HomeContent').value;
		
		//Regular exception check empty data
		re = /^(\s)*$/i;
		str = RegExp(re);
		
		
		//Regular exception check valid email
		re_email = /^([a-zA-Z0-9_.])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+/i;
		str_email = RegExp(re_email);

		//Check contact_name
		if(str.test(txtname))
		{
			alert("Bạn chưa nhập họ và tên");
			document.getElementById("HomeFullname").focus();
			return false;
		}
		
		//check email empty
		if(str.test(txtemail))
		{
			alert("Bạn chưa nhập địa chỉ email");
			document.getElementById("HomeEmail").focus();
			return false;
		}
		
		//check valid email
		if(!str_email.test(txtemail))
		{
			alert("Địa chỉ email của bạn không hợp lệ");
			document.getElementById("HomeEmail").focus();
			return false;
		}

		//check empty content
		if(str.test(txtcontent))
		{
			alert("Bạn chưa nhập nội dung");
			document.getElementById("HomeContent").focus();
			return false;
		}
			
		document.getElementById("HomeSubmitContactForm").submit();
	}
// -->
</script>
<table width="500" cellpadding="5">
	<tr>
	<td colspan="2" ><h3><?php echo $this->data['Company']['name']?></h3></td>
	</tr>
	<tr>
	<td width="89" class="ct-text">Địa chỉ: </td>
	<td width="383"><?php echo $this->data['Company']['address']?></td>
	</tr>
	  <tr>
	<td class="ct-text">Điện thoại: </td>
	<td><?php echo $this->data['Company']['tel']?></td>
	</tr>
	<tr>
	<td class="ct-text">Email:</td>
	<td><?php echo $this->data['Company']['email']?></td>
	</tr>
 	<tr>
	<td class="ct-text">Website:</td>
	<td><?php echo $this->data['Company']['website']?></td>
	</tr>
</table>
<style>
.contactForm{padding:5px;background:#4271c8}
.contactForm label
{
	
}
.contactForm input
{
	margin-right:100px;
	
}
</style>
<?php echo $form->create('Home',array('url'=>'/home/submitContact'));?>
<div class="contactForm">
	<table>
		<tr>
			<td style="text-align: right;">Tên bạn</td>
			<td><?php echo $form->input('fullname', array('label' => '')); ?></td>
		</tr>
		<tr>
			<td style="text-align: right;">Điện thoại</td>
			<td><?php echo $form->input('tel', array('label' => '')); ?></td>
		</tr>
		<tr>
			<td style="text-align: right;">Email</td>
			<td><?php echo $form->input('email', array('label' => '')); ?></td>
		</tr>
		<tr>
			<td style="text-align: right;">Nội dung</td>
			<td><?php echo $form->input('content', array('label' => '', 'style'=>'width:375px; height:215px; float:none; margin:auto')); ?></td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td><input type="image" src="<?php echo $html->url('/img/send.png');?>" onclick=" return validateForm();" style="float:none" /></td>
		</tr>
	</table>
</div>
<?php echo $form->end();?>
<div class="end_div_center span-4 last" ></div>
<div style="clear:both">&nbsp;</div>
